home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFUNCS / FRMDESKT.C < prev    next >
C/C++ Source or Header  |  1992-11-06  |  2KB  |  57 lines

  1. /**************************************************************************
  2.  *
  3.  *************************************************************************/
  4.  
  5. #include "gemfintl.h"
  6.  
  7. #ifndef LATTICE
  8. short wind_newdesk(tree, obj)
  9.     OBJECT *tree;
  10.     short  obj;
  11. {
  12.     int upr, lwr;
  13.     
  14.     upr = (int)((long)tree >> 16);
  15.     lwr = (int)((long)tree & 0x0000FFFF);
  16.     
  17.     return wind_set(0, WF_NEWDESK, upr, lwr, obj, 0);
  18. }
  19. #endif
  20.  
  21. void  frm_desktop(options, ptree)
  22.     long             options;
  23.     register OBJECT  *ptree;
  24. {
  25.     register OBJECT  *pobj2;
  26.     short              fill;
  27.     short              color;
  28.     long              ospec;
  29.  
  30.     wind_update(BEG_UPDATE);
  31.     if ((options & FRM_DTREMOVE) || ptree == NULL) {
  32.         wind_newdesk(NULL, 0);
  33.     } else {
  34.         if (options & FRM_CENTER) {
  35.             rc_copy(&gl_rwdesk, (GRECT*)&ptree->ob_x); /* copy desk xywh to tree    */
  36.             if (!(ptree->ob_flags & LASTOB)) { /* if there's another object */
  37.                 pobj2 = ptree + 1;               /* center it on the screen    */
  38.                 pobj2->ob_x = (ptree->ob_width    - pobj2->ob_width)    / 2;
  39.                 pobj2->ob_y = (ptree->ob_height - pobj2->ob_height) / 2;
  40.             }
  41.         }
  42.         apl_vshared();                               /* fill in gl_vwout[]  */
  43.         if (gl_vwout[13] == 2) {                   /* monochrome monitor? */
  44.             ospec  = (long)ptree->_Ob_spec;        /* if so, and the      */
  45.             fill  = (short)((ospec & 0x00000070L) >> 4);    /* desktop is a solid  */
  46.             color = (short)(ospec & 0x0000000FL);              /* color, change it to */
  47.             if (fill == 7 && color > 0) {           /* halftone gray.      */
  48.                 ptree->_Ob_spec = (_Ob_spec_t)((ospec & 0xFFFFFF00L) | 0x00000041L);
  49.             }
  50.         }
  51.         wind_newdesk(ptree, 0);
  52.     }
  53.     wind_update(END_UPDATE);
  54.     frmx_dial(FMD_FINISH, NULL, &gl_rwdesk);    /* paint the new desktop */
  55. }
  56.  
  57.